<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>javascript 阶段</title>
    <style>
        .search {
            width: 500px;
            height: 40px;
            background-color: #ccc;
            margin: 100px auto 50px;
            border: 3px solid #f56;
            line-height: 40px;
            
        }
    </style>
</head>
<body>
    <div class="search">不可编辑的</div>


    <!-- contenteditable="true" 设置当前标签为可编辑状态 -->
    <div class="search search-2" contenteditable="true">可编辑的</div>

    <script>
        // 是div标签 ， 不是input标签

        // 获取.search-2标签
        var search2 = document.querySelector(".search-2");

        // 获取当前div标签文本 
        var txt = search2.innerText;
        // 打印div文本
        console.log(txt);

    </script>
</body>
</html>